package com.netty.demo10;

import java.nio.ByteBuffer;

/**
 * Created by Lxk on 2020/2/2.
 */
public class NioTest5 {
    //存取类型应该一致
    public static void main(String[] args) {
        ByteBuffer byteBuffer = ByteBuffer.allocate(100);
        byteBuffer.putInt(10);
        byteBuffer.putLong(50000000L);
        byteBuffer.putDouble(1.0);
        byteBuffer.putChar('你');
        byteBuffer.putShort((short)2);

        byteBuffer.flip();
        System.out.println(byteBuffer.getInt());
        System.out.println(byteBuffer.getLong());
        System.out.println(byteBuffer.getDouble());
        System.out.println(byteBuffer.getChar());
        System.out.println(byteBuffer.getShort());
    }

}
